# Maintainer: Cowington Post <cowingtonpost@gmail.com>
pkgname=agate
pkgver=3.3.3
pkgrel=0
pkgdesc="Simple Gemini server for static files"
url="https://github.com/mbrubeck/agate"
# rust-ring
arch="all !s390x !ppc64le !riscv64"
license="Apache-2.0"
makedepends="cargo cargo-auditable"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mbrubeck/agate/archive/refs/tags/v$pkgver.tar.gz
	agate.initd
	agate.confd
	"

prepare() {
	default_prepare

	sed -i 's/version = "3.3.1"/version = "3.3.3"/' Cargo.lock

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release
}

check() {
	cargo test
}

package() {
	install -Dm755 target/release/agate -t "$pkgdir"/usr/bin
	install -Dm755 "$srcdir"/agate.initd "$pkgdir"/etc/init.d/agate
	install -Dm644 "$srcdir"/agate.confd "$pkgdir"/etc/conf.d/agate
}

sha512sums="
e3cd2af876fbb8fb05e128ec3fd1a3bb135c614b909472b97773ce2499ab9e2e2c58f3b772d04b7cf48076da1d49b4e5c5da48ce397359d45174d8f023dd8ee4  agate-3.3.3.tar.gz
711c7687e3e5421d0d625a11aa0067cc5fb4dbe9656e8d9aee2dd1a0fa0befe7a83c705c4875c8f20d3701fa0557c80af4b82373bade7c5be2c4dbd27e9f5141  agate.initd
d8f54616edafaf513c591fc3ab405c65044a8f43cf1e50e43c7cac5ae3fa5c383a267108c10210ea236a5edfa1fcf2014a932e77bc216cc06dce83cab7e32c85  agate.confd
"
